package Homework;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Random;

/*在你生成的文件中，生成10个男生或者10个女生的姓名.
被点到的学生的姓名不会再被点到，如果都点完了，才开始第二轮点名*/
public class work09 {
    public static void main(String[] args) throws Exception {
        ArrayList<String> list = new ArrayList();
        BufferedReader br1 = new BufferedReader(new FileReader("names.txt"));
        String line1;
        while ((line1 = br1.readLine()) != null) {
            list.add(line1);
        }
        System.out.println(list);
        ArrayList<String> list1 = new ArrayList();
        list1.addAll(list);
        for (int count = 1; count < 3; count++) {
            System.out.println("第"+count+"轮点名");
            while (list.size() > 0) {
                Random r = new Random();
                int i = r.nextInt(list.size());
                System.out.println(list.get(i));
                list.remove(i);
            }
            list.addAll(list1);
        }
    }
}
